package com.orange.score.model.index;

import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class CompanyManager
{
  private static String TAG = OddsManager.class.getName();
  Map<String, Company> companyMap;
  List<Company> daxiaoCompanyList;
  private Set<Company> daxiaoSelectedSet;
  List<String> defaultSelectedCompanyIdList;
  OddsType oddsType;
  List<Company> oupeiCompanyList = new ArrayList();
  private Set<Company> oupeiSelectedSet;
  List<Company> yapeiCompanyList;
  private Set<Company> yapeiSelectedSet;

  public CompanyManager()
  {
    this.daxiaoCompanyList = new ArrayList();
    this.yapeiCompanyList = new ArrayList();
    this.defaultSelectedCompanyIdList = new ArrayList();
    this.oddsType = OddsType.YAPEI;
    this.companyMap = new HashMap();
    this.yapeiSelectedSet = new HashSet();
    this.oupeiSelectedSet = new HashSet();
    this.daxiaoSelectedSet = new HashSet();
  }

  private void classifyCompany(Company paramCompany)
  {
    if (paramCompany.haveYapei)
      this.yapeiCompanyList.add(paramCompany);
    if (paramCompany.haveDaxiao)
      this.daxiaoCompanyList.add(paramCompany);
    if (paramCompany.haveOupei)
      this.oupeiCompanyList.add(paramCompany);
  }

  public String getCompanyNameById(String paramString)
  {
    return ((Company)this.companyMap.get(paramString)).companyName;
  }

  public List<Company> getDaxiaoCompanyList()
  {
    return this.daxiaoCompanyList;
  }

  public Set<Company> getDaxiaoSelectedSet()
  {
    return this.daxiaoSelectedSet;
  }

  public List<String> getDefaultSelectedCompanyIdList()
  {
    return this.defaultSelectedCompanyIdList;
  }

  public OddsType getOddsType()
  {
    return this.oddsType;
  }

  public List<Company> getOupeiCompanyList()
  {
    return this.oupeiCompanyList;
  }

  public Set<Company> getOupeiSelectedSet()
  {
    return this.oupeiSelectedSet;
  }

  public List<Company> getYapeiCompanyList()
  {
    return this.yapeiCompanyList;
  }

  public Set<Company> getYapeiSelectedSet()
  {
    return this.yapeiSelectedSet;
  }

  public void setDaxiaoSelectedSet(Set<Company> paramSet)
  {
    this.daxiaoSelectedSet = paramSet;
  }

  public void setDefaultSelectedCompanyIdList(List<String> paramList)
  {
    this.defaultSelectedCompanyIdList = paramList;
  }

  public void setOddsType(OddsType paramOddsType)
  {
    this.oddsType = paramOddsType;
  }

  public void setOupeiSelectedSet(Set<Company> paramSet)
  {
    this.oupeiSelectedSet = paramSet;
  }

  public void setYapeiSelectedSet(Set<Company> paramSet)
  {
    this.yapeiSelectedSet = paramSet;
  }

  public void updateCompanyDataFromStringList(String[] paramArrayOfString)
  {
    if ((paramArrayOfString == null) || (paramArrayOfString.length == 0))
      return;
    this.oupeiCompanyList.clear();
    this.daxiaoCompanyList.clear();
    this.yapeiCompanyList.clear();
    this.companyMap.clear();
    int i = 0;
    if (i >= paramArrayOfString.length)
    {
      this.defaultSelectedCompanyIdList.clear();
      int j = 0;
      while (true)
      {
        if (j >= 4);
        this.defaultSelectedCompanyIdList.add(((Company)this.yapeiCompanyList.get(j)).getCompanyId());
        ++j;
      }
    }
    String[] arrayOfString = paramArrayOfString[i].split("\\^");
    if (arrayOfString.length < 5)
      Log.w(TAG, "updateCompanyDataFromStringList but field count not enough, count = " + arrayOfString.length);
    while (true)
    {
      while (true)
        ++i;
      String str1 = arrayOfString[0];
      String str2 = arrayOfString[1];
      String str3 = arrayOfString[2];
      String str4 = arrayOfString[4];
      Company localCompany = new Company(str1, str2, str3, arrayOfString[3], str4);
      Log.d(TAG, "add company = " + localCompany.toString());
      classifyCompany(localCompany);
      this.companyMap.put(str1, localCompany);
    }
  }
}